#ifndef GENERATOR_MULTINOMIAL_HEADER
#define GENERATOR_MULTINOMIAL_HEADER

#include<string>
#include<fstream>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<iterator>
#include<vector>
#include<map>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include <gsl/gsl_randist.h>
#include "def.hpp"

// gsl_ran_multinomial (const gsl_rng * r, size_t K, unsigned int N, const double p[], unsigned int n[])
using namespace std;

int GE_Multinomial(gsl_rng* r){

  ofstream outFile;
  outFile.open(PuzaDEF::Instance()->output_file_name.c_str());

  for(int i =0; i < PuzaDEF::Instance()->GE_Samples; i++){
    gsl_ran_multinomial(r, PuzaDEF::Instance()->GE_Multinomial_K, PuzaDEF::Instance()->GE_Multinomial_N, PuzaDEF::Instance()->GE_Multinomial_P, PuzaDEF::Instance()->GE_Multinomial_Data);  
    outFile << i << "\t";
    for(int k=0; k < PuzaDEF::Instance()->GE_Multinomial_K; k++){                                                                                                                                     
      outFile << k << ":" << PuzaDEF::Instance()->GE_Multinomial_Data[k] << " ";                                                                                           
    }                                                                                                                                                                            
    outFile << endl;  
  }
  outFile.close();
  return 0;
}

#endif
